package intopo.game.strategy;

/**
 * A class that represents a constant strategy parameter.
 */
final public class ConstantStrategyParameter<T extends Object>
	implements StrategyParameter<T>
{
	/**
	 * The name of this strategy parameter.
	 */
	final private String name;

	/**
	 * The value of this strategy parameter.
	 */
	final private T value;

	/**
	 * Sole constructor.
	 * @param name The name of this strategy parameter.
	 * @param value The value of this strategy parameter.
	 */
	public ConstantStrategyParameter (String name, T value)
	{
		this.name = name;
		this.value = value;
	}

	public String getName ()
	{
		return name;
	}

	public T getValue ()
	{
		return value;
	}

	/**
	 * This method always throws {@code UnsupportedOperationException} as this parameter is constant.
	 *
	 * @throws UnsupportedOperationException This is a constant parameter
	 */
	final public void setValue (T newValue)
		throws UnsupportedOperationException
	{
		throw new UnsupportedOperationException ("Operation not supported on strategy parameter " + name);
	}
}
